<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePlayerUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('player_users', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->index();
            $table->integer('league_id')->index()->comment('当前所属联赛');
            $table->integer('cup_id')->index()->comment('当前所属杯赛');
            $table->string('realname', 50)->default('')->comment('真实姓名');
            $table->integer('age')->default(0)->comment('年龄');
            $table->integer('number')->default(0)->comment('号码');
            $table->string('height', 50)->default('')->comment('身高');
            $table->string('weight', 50)->default('')->comment('体重');
            $table->integer('strength')->default(1)->comment('实力');
            $table->integer('level')->default(1)->comment('默认分档');
            $table->string('site', 50)->default('')->comment('擅长位置');
            $table->string('join_season', 50)->default('')->comment('加入联盟时赛季数');
            $table->date('join_date')->comment('加入联盟日期');


            $table->float('balance')->comment('账户余额');
            $table->integer('league_total_time')->default(0)->comment('个人自加入联盟后，联盟组织的总比赛周次');
            $table->integer('join_total_time')->default(0)->comment('个人自加入联盟后，参加总周次');
            $table->string('attendance_rate', 50)->default('')->comment('出勤率');

            $table->integer('league_total_game')->default(0)->comment('个人自加入联盟后，联盟组织的总比赛场数');
            $table->integer('join_game')->default(0)->comment('参加比赛场数');
            $table->integer('goalkeeper_game')->default(0)->comment('门将场数');
            $table->integer('referee_game')->default(0)->comment('裁判场数');
            $table->integer('win_game')->default(0)->comment('胜利比赛场数');
            $table->string('win_rate', 50)->default('')->comment('胜率');

            $table->integer('goals')->default(0)->comment('进球总数');
            $table->integer('assists')->default(0)->comment('助攻总数');
            $table->integer('champion_time')->default(0)->comment('冠军次数');
            $table->integer('award_time')->default(0)->comment('奖励次数');
            $table->integer('down_time')->default(0)->comment('降级次数');
            $table->integer('ignore_time')->default(0)->comment('不计排名次数');

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('player_users');
    }
}
